//
//  ClassVideoViewController.m
//  Products_B
//
//  Created by lanou on 16/5/28.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "ClassVideoViewController.h"
#import "ClassVideoTableViewCell.h"
#import "ClassVideoModel.h"
#import "MyHeaderView.h"
#import "PlayVideoModel.h"
#import "PlayVideoViewController.h"
#import "AboutClassModel.h"
#import "AboutClassCollectionViewCell.h"
#import "PlayListCollectionViewController.h"
#import "PlayAboutClassViewController.h"
#define kCookVideo @"http://api.izhangchu.com/?appVersion=4.4&sysVersion=9.3.2&devModel=iPhone"
// http://video.szzhangchu.com/1463387408357_6919927075.mp4
// 视频Url http://video.szzhangchu.com/1463993151941_5707590839.mp4
// 分享Url http://m.izhangchu.com/micro/shike.php?&material_id=44
@interface ClassVideoViewController () <UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate , UICollectionViewDelegateFlowLayout,UITextFieldDelegate>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) NSMutableArray *commentModelArray;
@property (nonatomic, strong) NSMutableArray *videoModelArray;
@property (nonatomic, strong) MyHeaderView *myHeaderView;
@property (nonatomic, strong) UILabel *fayanLabel;
@property (nonatomic, strong) UIView *groundView;
@property (nonatomic, strong) UITextField *commentTextField;
@property (nonatomic, strong) UIButton *sendButton;
// 以这个变量，是用来跟随点击了哪个课程集数的button，第一次进入该界面时，没有点击任何button,默认j值为0
@property (nonatomic, assign) NSInteger j;
// 是否点击button
@property (nonatomic, assign) BOOL isClick;
@property (nonatomic, assign) BOOL isClick2;
@property (nonatomic, assign) BOOL isClick3;

@property (nonatomic, strong) NSMutableArray *aboutClassArray;

@property (nonatomic, strong) NSDictionary *dic;

@property (nonatomic, assign) NSInteger page;
@end

@implementation ClassVideoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.hidden = NO;
    // 第一次进入该界面时，没有点击任何课程集数的button,设置j值为0
    self.j = 0;
    
    _page = 1;
    _commentModelArray = [NSMutableArray array];
    self.aboutClassArray = [NSMutableArray array];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight - 64)];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_tableView];
    
    // 注册自定义的表视图cell
    [_tableView registerClass:[ClassVideoTableViewCell class] forCellReuseIdentifier:@"classVideoTableViewCell"];
   
    [self layoutHeaderView];
    
    // 请求评论数据
    [self requestCommentData];
    
    [self loadMoreData];
    [self updateData];
    
    // 请求tableView头部数据
    [self requestNetworkClassVideo];
    
}

// 布局tableView的头部
- (void)layoutHeaderView {
    _myHeaderView = [[MyHeaderView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 0) clickButtonBlock:^(UIButton *button) {
        if (button.tag == 103) {
            if (!_isClick) {
                CGRect frame = _myHeaderView.contentLabel.frame;
                frame.size.height = 0;
                [UIView animateWithDuration:0.5 animations:^{
                    _myHeaderView.contentLabel.frame = frame;
                    [self.myHeaderView layoutMySubViewsOfContentLabel];
                    [self setCollectionViewFrame];
                    [self reSetHeaderHeight];
                }];
                [button setImage:[UIImage imageNamed:@"cookClassXiala.png"] forState:UIControlStateNormal];

            } else {
                [UIView animateWithDuration:0.5 animations:^{
                    [self.myHeaderView layoutMySubViews];
                    [self setCollectionViewFrame];
                    [self reSetHeaderHeight];
                }];
                [button setImage:[UIImage imageNamed:@"cookClassShouqi.png"] forState:UIControlStateNormal];
            }
             _isClick = !_isClick;
        }
        
        if (button.tag == 104) {
            if (_isClick2) {
                self.myHeaderView.buttonView2.hidden = YES;
                self.myHeaderView.buttonView.frame = CGRectMake(20, _myHeaderView.xuanjiLabel.frame.origin.y + _myHeaderView.xuanjiLabel.frame.size.height + 15, kWidth - 40, (kWidth - 40 - 35) / 8 * 2 + 10);
                [self setCollectionViewFrame];
                [self reSetHeaderHeight];
                [button setImage:[UIImage imageNamed:@"cookClassXiala.png"] forState:UIControlStateNormal];
            } else {
                _myHeaderView.buttonView2.hidden = NO;
                _myHeaderView.buttonView.frame = CGRectMake(20, _myHeaderView.xuanjiLabel.frame.origin.y + _myHeaderView.xuanjiLabel.frame.size.height + 15, kWidth - 40, (_upDateToClassNumber / 8 + 1) * (kWidth - 40 - 35) / 8 + (_upDateToClassNumber / 8) * 5);
                [self setCollectionViewFrame];
                [self reSetHeaderHeight];
                [button setImage:[UIImage imageNamed:@"cookClassShouqi.png"] forState:UIControlStateNormal];
            }
            _isClick2 = !_isClick2;
            [self.myHeaderView layoutMySubViewsOfButton];
        }
       
        // 点击播放按钮时回调该block
        if (button.tag == 110) {
            if (!_isClick3) {
                PlayVideoViewController *playVc = [[PlayVideoViewController alloc] init];
                NSLog(@"++++++++++++ %ld",_j);
                // j值就是点击过的课程集数button的tag值，如果第一次进入该界面没有点击任何button，则j值默认为0，即从第一集开始播放
                PlayVideoModel *playModel = self.videoModelArray[self.j];
                playVc.videoURL = playModel.course_video;
                
                NSLog(@"+++++++++++ %@",playModel.course_video);
                
                [self.navigationController pushViewController:playVc animated:YES];
            }
            _isClick3 = !_isClick3;
        }
        
        // 这个for循环，是专门对课程集数的button而写的,点击每一个button都改动相应的课程图片，使得图片与课程内容相吻合。
        for (int i = 200; i < 200 + _upDateToClassNumber; i++) {
            // 判断点击了哪个button
            if (i == button.tag) {
                // 将点击过button对应的tag值定义成全局变量，因为别处需要用到
                self.j = i - 200;
                PlayVideoModel *playModel = self.videoModelArray[i - 200];
                [self.myHeaderView.videoImageView sd_setImageWithURL:[NSURL URLWithString:playModel.course_image]];
            }
        }
        
        if (button.tag == 106) {
            UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
            PlayListCollectionViewController *playListVC = [[PlayListCollectionViewController alloc] initWithCollectionViewLayout:layout];
            playListVC.listModelArray = _aboutClassArray;
            playListVC.aboutClassString = _myHeaderView.abouClass.text;
            [self.navigationController pushViewController:playListVC animated:YES];
        }
    }];
    self.myHeaderView.upDateToClassNumber = _upDateToClassNumber;
    _myHeaderView.backgroundColor = [UIColor whiteColor];
    
}

// 请求评论的数据
- (void)requestCommentData {
    // NSDictionary *parDic = @{@"methodName":@"CommentList",@"page":@1,@"relate_id":@(_ralateId),@"size":@10,@"token":@"520B46DBD3C835733C9E7D2E345754A9",@"type":@2,@"user_id":@1513438,@"version":@4.4};
    NSDictionary *parDic = @{@"methodName":@"CommentList",@"page":@1,@"relate_id":@(_ralateId),@"size":@10,@"token":@"520B46DBD3C835733C9E7D2E345754A9",@"type":@2,@"version":@4.4};
    [RequestManager requestWithUrl:kCookVideo requestType:RequestTypePOST parDic:parDic finish:^(NSData *data) {
        NSDictionary *jsDic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
        NSLog(@" -------------- %@",jsDic);
        // 评论数组
        NSMutableArray *tempModelArray = [ClassVideoModel classVideoModelAnalyseDataWithJsonDic:jsDic];
        [self.commentModelArray addObjectsFromArray:tempModelArray];

        dispatch_async(dispatch_get_main_queue(), ^{
            // 多少条发言
            _fayanLabel.text = [NSString stringWithFormat:@"%@条发言",jsDic[@"data"][@"total"]];
            
            [self.tableView reloadData];
            
            [self.tableView.mj_header endRefreshing];
            [self.tableView.mj_footer endRefreshing];
        });
        
    } error:^(NSError *error) {
        NSLog(@"请求数据失败");
    }];
}

// 上拉加载更多
- (void)loadMoreData {
    self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        _page += 1;
        [self requestCommentData];
    }];
}

// 下拉刷新
- (void)updateData {
    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        _page = 1;
        [self.commentModelArray removeAllObjects];
        [self requestCommentData];
    }];
}

// 请求tableView头部数据
- (void)requestNetworkClassVideo {
    // NSDictionary *parDic = @{@"methodName":@"CourseSeriesView",@"series_id":@(_ralateId),@"token":@"520B46DBD3C835733C9E7D2E345754A9",@"user_id":@0,@"version":@4.4};
    NSDictionary *parDic = @{@"methodName":@"CourseSeriesView",@"series_id":@(_ralateId),@"token":@"520B46DBD3C835733C9E7D2E345754A9",@"version":@4.4};
    [RequestManager requestWithUrl:kCookVideo requestType:RequestTypePOST parDic:parDic finish:^(NSData *data) {
        NSDictionary *jsDic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
        NSLog(@" ++++ %@",jsDic);
        // 装视频的model数组
        self.videoModelArray = [PlayVideoModel playVideoModelAnalyseDataWithJsonDic:jsDic];
        
        // 请求相关课程的数据,该请求必须在请求tableView头部数据之后，因为请求相关课程的数据时，需要一个参数course_id,而这个course_id只有在请求完tableView头部数据之后才能得到。
        [self requestAboutClassData];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            
            // 课程图片（顶部的）
            [self.myHeaderView.videoImageView sd_setImageWithURL:[NSURL URLWithString:jsDic[@"data"][@"series_image"]]];
            self.myHeaderView.personLabel.text = [NSString stringWithFormat:@"上课人数:%@",jsDic[@"data"][@"play"]] ;
            // 取出字符串
            NSString *series_nameString = jsDic[@"data"][@"series_name"];
            // 分割字符串
            NSArray *arr = [series_nameString componentsSeparatedByString:@"#"];
            // 取数组最后一个元素作为标题
            self.myHeaderView.titleLabel.text = arr.lastObject;
            // 设置导航栏的标题
            self.navigationItem.title = arr[1];
            // 课程内容
            self.myHeaderView.contentLabel.text = jsDic[@"data"][@"series_title"];
            [self.myHeaderView layoutMySubViews];
            // 更新集标签
            self.myHeaderView.updateLabel.text = [NSString stringWithFormat:@"更新至%@集",jsDic[@"data"][@"episode"]];
            _upDateToClassNumber = [self.myHeaderView.updateLabel.text integerValue];
            // 属性传值
            _myHeaderView.upDateToClassNumber = [jsDic[@"data"][@"episode"] intValue];
            self.myHeaderView.likeNumLabel.text = [NSString stringWithFormat:@"%@位厨友觉得很赞",jsDic[@"data"][@"relate_activity"]];

            // 创建collectionView
            [self creatCollectionView];
         
            // 重设headerView
            [self reSetHeaderHeight];
            // 刷新表视图
            [self.tableView reloadData];
            
        });
        
    } error:^(NSError *error) {
        NSLog(@"请求数据失败");
    }];
}

// 重设headerView的高度,不仅一次需要调用
- (void)reSetHeaderHeight {
    _myHeaderView.frame = CGRectMake(0, 0, kWidth, _myHeaderView.videoImageView.frame.size.height + 10 + _myHeaderView.personLabel.frame.size.height + 20 + _myHeaderView.titleLabel.frame.size.height + 5 + 10 + 20 + _myHeaderView.contentLabel.frame.size.height + _myHeaderView.buttonView.frame.size.height + 10 + _myHeaderView.xuanjiLabel.frame.size.height + _myHeaderView.likeNumLabel.frame.size.height + 10 + _myHeaderView.abouClass.frame.size.height + _collectionView.frame.size.height + 10 + 100 + _fayanLabel.frame.size.height);
    _tableView.tableHeaderView = _myHeaderView;
}

// 返回行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   return self.commentModelArray.count;
}

// 返回cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ClassVideoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"classVideoTableViewCell" forIndexPath:indexPath];
    ClassVideoModel *model = self.commentModelArray[indexPath.row];
    cell.classVideoModel = model;
    return cell;
}

// 返回cell的动态高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [ClassVideoTableViewCell cellForHeigh:self.commentModelArray[indexPath.row]];
}


#pragma mark - 当push的时候隐藏tabBar
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.hidesBottomBarWhenPushed = YES;
    }
    return self;
}

#pragma mark - 创建collectionView
- (void)creatCollectionView {
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
    _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, _myHeaderView.videoImageView.frame.size.height + 10 + _myHeaderView.personLabel.frame.size.height + 20 + _myHeaderView.titleLabel.frame.size.height + 5 + 10 + 20 + _myHeaderView.contentLabel.frame.size.height + _myHeaderView.buttonView.frame.size.height + 10 + _myHeaderView.xuanjiLabel.frame.size.height + _myHeaderView.likeNumLabel.frame.size.height + 10 + _myHeaderView.abouClass.frame.size.height, kWidth, kWidth * 3 / 10) collectionViewLayout:flowLayout];
    _collectionView.dataSource = self;
    _collectionView.delegate  = self;
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    _collectionView.backgroundColor = [UIColor whiteColor];
    [self.myHeaderView addSubview:_collectionView];
    // 注册
    [_collectionView registerClass:[AboutClassCollectionViewCell class] forCellWithReuseIdentifier:@"aboutClassCollectionViewCell"];
    
    _fayanLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, _collectionView.frame.origin.y + _collectionView.frame.size.height + 50, 100, 30)];
    [self.myHeaderView addSubview:_fayanLabel];
    
    UIImageView *cameraImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth - 60, _collectionView.frame.origin.y + _collectionView.frame.size.height + 30, 30, 30)];
    cameraImageView.image = [UIImage imageNamed:@"CookClassCamera.png"];
    cameraImageView.userInteractionEnabled = YES;
    [self.myHeaderView addSubview:cameraImageView];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
    [cameraImageView addGestureRecognizer:tap];
    
    
    UILabel *workLabel = [[UILabel alloc] initWithFrame:CGRectMake(kWidth - 65, _collectionView.frame.origin.y + _collectionView.frame.size.height + 60, 60, 20)];
    workLabel.text = @"交作业";
    workLabel.font = [UIFont systemFontOfSize:12];
    workLabel.textColor = [UIColor orangeColor];
    [self.myHeaderView addSubview:workLabel];
    
    UIButton *speakButton = [UIButton buttonWithType:UIButtonTypeCustom];
    speakButton.backgroundColor = [UIColor orangeColor];
    speakButton.frame = CGRectMake(20, _fayanLabel.frame.origin.y + _fayanLabel.frame.size.height + 20, kWidth - 40, 30);
    [speakButton setTitle:@"课堂发言" forState:UIControlStateNormal];
    speakButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [speakButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [speakButton addTarget:self action:@selector(speakButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.myHeaderView addSubview:speakButton];
    
}
// 设置collectionView的frame
- (void)setCollectionViewFrame {
    _collectionView.frame = CGRectMake(0, _myHeaderView.videoImageView.frame.size.height + 10 + _myHeaderView.personLabel.frame.size.height + 20 + _myHeaderView.titleLabel.frame.size.height + 5 + 10 + 20 + _myHeaderView.contentLabel.frame.size.height + _myHeaderView.buttonView.frame.size.height + 10 + _myHeaderView.xuanjiLabel.frame.size.height + _myHeaderView.likeNumLabel.frame.size.height + 10 + _myHeaderView.abouClass.frame.size.height, kWidth, kWidth * 3 / 10);
}

#pragma mark - collectionView的代理方法
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    NSLog(@" %ld",_aboutClassArray.count);
    return _aboutClassArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    AboutClassCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"aboutClassCollectionViewCell" forIndexPath:indexPath];
    cell.aboutClassModel = self.aboutClassArray[indexPath.row];
    return cell;
}

// 返回collectionCell的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return CGSizeMake(kWidth * 3 / 10, kWidth * 3 / 10);
}


// 当设置为横向滑动的时候，列间距就是行间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
    return 0;
}

// 点击collectionViewCell的方法
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    PlayAboutClassViewController *playAboutClassVC = [[PlayAboutClassViewController alloc] init];
    AboutClassModel *model = self.aboutClassArray[indexPath.row];
    playAboutClassVC.dishUrlString = model.process_video;
    [self presentViewController:playAboutClassVC animated:YES completion:nil];
}

#pragma mark - 请求相关课程的数据
- (void)requestAboutClassData {
    // 每一个playModel都有一个course_id，经检验，我们需要的是最后一个playModel的course_id
    PlayVideoModel *playModel = self.videoModelArray.lastObject;
    NSDictionary *parDic = @{@"course_id":@(playModel.course_id),@"methodName":@"CourseRelate",@"page":@1,@"size":@10,@"token":@"520B46DBD3C835733C9E7D2E345754A9",@"version":@4.4};
    [RequestManager requestWithUrl:kCookVideo requestType:RequestTypePOST parDic:parDic finish:^(NSData *data) {
        NSDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
        NSLog(@" ========================== %@",jsonDic);
        NSMutableArray *tempModelArray = [AboutClassModel aboutClassModelAnalyseDataWithJsonDic:jsonDic];
        [self.aboutClassArray addObjectsFromArray:tempModelArray];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            [_collectionView reloadData];
        });
    } error:^(NSError *error) {
        NSLog(@"请求数据失败");
    }];
}

- (void)tapAction:(UIGestureRecognizer *)tap {
#warning ???
    // 跳转到朋学友界面
}

// 课堂发言
- (void)speakButtonAction:(UIButton *)button {
    _groundView.hidden = NO;
    // 点击button时，让_textField成为第一响应者
    [_commentTextField becomeFirstResponder];
}

- (void)creatBottomView {
    _groundView = [[UIView alloc] initWithFrame:CGRectMake(0, kHeight - 50 - 64, kWidth, 50)];
    _groundView.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:1];
    _groundView.hidden = YES;
    [self.view addSubview:_groundView];
    
    _commentTextField = [[UITextField alloc] initWithFrame:CGRectMake(8, 10, kWidth - 76, 30)];
    _commentTextField.placeholder = @"写下我的评论";
    _commentTextField.font = [UIFont systemFontOfSize:14];
    _commentTextField.layer.cornerRadius = 5;
    _commentTextField.layer.masksToBounds = YES;
    _commentTextField.delegate = self;
    _commentTextField.backgroundColor = [UIColor whiteColor];
    [_groundView addSubview:_commentTextField];
    
    _sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _sendButton.frame = CGRectMake(kWidth - 60, 10, 50, 30);
    _sendButton.backgroundColor = [UIColor orangeColor];
    _sendButton.layer.cornerRadius = 5;
    _sendButton.layer.masksToBounds = YES;
    [_sendButton setTitle:@"发送" forState:UIControlStateNormal];
    [_sendButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    _sendButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [_sendButton addTarget:self action:@selector(sendButton:) forControlEvents:UIControlEventTouchUpInside];
    [_groundView addSubview:_sendButton];
}

- (void)sendButton:(UIButton *)button {
    // 发送
    
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [self creatBottomView];
    // 监听键盘的行为
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
}

- (void)keyboardWillChangeFrame:(NSNotification *)notification {
    // 取出键盘动画的时间
    CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
    // 取出键盘frame
    CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
    // 计算view需要平移的距离
    CGFloat tranformY = keyboardFrame.origin.y - self.view.frame.size.height - 64;
    NSLog(@" +++ %f",self.view.frame.size.height);
    // 动画
    [UIView animateWithDuration:duration animations:^{
        self.view.transform = CGAffineTransformMakeTranslation(0, tranformY);
    }];
}

// 点击return回收键盘
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}

// 滑动tableView时退出键盘
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    [self.view endEditing:YES];
}

- (void)dealloc {
    // 移除键盘
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
